#include "World.h"

#include "Component/Primitive/StaticMeshComponent.h"
#include "Runtime/Rendering/Scene.h"

namespace Alice
{
    World* World::CreateWorld(const EWorldType::Type InWorldType, bool bInformEngineOfWorld, bool bAddToRoot, bool bInSkipInitWorld)
    {
        World*world=new World;
        world->mWorldType=InWorldType;
        world->Init();
        return world;
    }
    void World::Init()
    {
        mCurrentLevel=new Level;
        Scene* scene=new Scene(this);
        mScene=scene;
        Actor*actor=new Actor;
        SceneComponent*rootComponent=new SceneComponent;
        actor->mRootComponent=rootComponent;
        rootComponent->mWorldPrivate=this;
        StaticMeshComponent*staticMeshComponent=actor->AddComponent<StaticMeshComponent>();
    }
    void World::Tick(float inDeltaTime)
    {
        mCurrentLevel->Tick(inDeltaTime);
    }
    void World::MarkActorComponentForNeededEndOfFrameUpdate(ActorComponent* inComponent, bool bForceGameThread)
    {
        mComponentsThatNeedEndOfFrameUpdate.push_back(inComponent);
    }
    void World::SendAllEndOfFrameUpdates()
    {
        //mComponentsThatNeedEndOfFrameUpdate.clear();
    }
}
